<template>
  <el-form size="mini">
    <el-form-item label="用户名">
      <el-input v-model="userinfo.ssn" ></el-input>
    </el-form-item>

    <el-form-item label="账号">
      <el-input v-model="userinfo.username" :readonly="true" ></el-input>
    </el-form-item>

    <el-form-item label="手机号">
      <el-input v-model="userinfo.phoneNum" ></el-input>
    </el-form-item>

    <el-form-item label="组织">
      <el-input v-model="userinfo.orgName" :readonly="true"></el-input>
    </el-form-item>

    <el-form-item label="角色">
      <el-input v-model="userinfo.roleName" readonly="readonly" :readonly="true"></el-input>
    </el-form-item>

    <el-form-item>
      <el-button @click="changeInfo" type="primary">修改</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
  export default {
    name: 'ProfileChangeInfo',
    data: function() {
      return {

      }
    },
    props: {
      userinfo: {
        id: null,
        ssn: null,
        username: null,
        phoneNum: null,
        orgName: null,
        roleName: null,
      },
    },
    methods: {
      changeInfo() {
        let formData = {...this.userinfo};
        delete formData['orgName']
        delete formData['roleName']
        this.$api.changeCurrentUser(formData).then(res => {
          this.$emit("update");
        })
      }
    }
  }
</script>

<style scoped>

</style>
